//
//  YuanXinURLProtocol.h
//  yuanxinwebview
//
//  Created by GJS on 2019/1/2.
//  Copyright © 2019 晏德智. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface YuanXinURLProtocol : NSURLProtocol<NSURLSessionDataDelegate>

+ (instancetype)instance;

@property (readwrite, nonatomic, strong) NSURLSessionConfiguration *config;//config是全局的，所有的网络请求都用这个config
@property (nullable, nonatomic, strong) NSDictionary<NSString *, NSString *> *requestHeaders;//添加请求头

+ (void)startListeningNetWorking;
+ (void)cancelListeningNetWorking;

+ (void)setConfig:(NSURLSessionConfiguration *)config;//config是全局的，所有的网络请求都用这个config，参见NSURLSession使用的NSURLSessionConfiguration
+ (void)setRequestHeaders:(NSDictionary<NSString *, NSString *> *)requestHeaders;//添加请求头
+ (void)setPostRequestBodies:(NSDictionary<NSString *, NSString *> *)postRequestBodies;//缓存post请求body
+ (void)setUseCache:(BOOL)ifUseCache;
+ (void)setUserName:(NSString *)userName;
+ (void)setPassword:(NSString *)password;

@end

NS_ASSUME_NONNULL_END
